Skip to content

Add debug module.#14

Open
danielbush wants to merge 1 commit intoDomainGroupOSS:masterfrom
danielbush:add-debug
Open

Add debug module.#14
danielbush wants to merge 1 commit intoDomainGroupOSS:masterfrom
danielbush:add-debug

Conversation

@danielbush
Copy link
Copy Markdown

@danielbush danielbush commented Feb 12, 2019

This is a

  • Breaking change
  • New feature
  • Bugfix

I have

What's changed

debug module is about 7k gzipped. Hmmm
Might go down a bit more when bundled.

screen shot 2019-02-12 at 11 50 05 am

},
"dependencies": {
"create-react-context": "^0.2.2",
"debug": "^4.1.1",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

preference is not to add extra dependancies when they are not absolutely necessary - can you add a debug helper script (which does console logs) instead of a 3rd party lib?

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeh I agree, can't say I've seen this much in OSS. Maybe if it accepted debug as an optional prop that would be better. Any examples of other libraries solving this problem @danielbush?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably the size is less than 7k when bundled and minified down a bit more but I get the point.

Yeh, it's not as common in the browser. I've used it in a complex spa where I can selectively enable debugging to see what the system is doing, eg localStorage.debug='containers*,system1,foo,bar' etc. and it gives nice coloured output and might complement a similar use of debug in the consumer of this component to allow us to trace failed variant activation.

However, given the situation, maybe we just JSON.parse localStorage.debugReactExperimentify and if truthy/falsey behave accordingly; if it fails, reset it to falsey and warn the user?
Feels more straightforward to me than passing in debug.

@albertstill @jooj123

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants